package com.platform.api.bzproject.controller;


import com.github.pagehelper.PageInfo;
import com.platform.api.bzproject.model.BzAllWallpaper;
import com.platform.api.bzproject.model.WalletDetails;
import com.platform.api.bzproject.service.IWalletDetailsService;
import com.platform.common.core.Result;
import com.platform.common.core.ResultCode;
import com.platform.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 钱包明细 前端控制器
 * </p>
 *
 * @author guoshao
 * @since 2022-01-02
 * 源码联系微信：2549789059
 */
@RestController
@RequestMapping("/u/walletDetails")
public class WalletDetailsController {

    @Autowired
    private IWalletDetailsService iWalletDetailsService;

    @GetMapping("/selectWalletDetails")
    public Result selectWalletDetails(WalletDetails walletDetails,Integer offset){

        try {
            String userId = SecurityUtils.getUser().getUserId();
            walletDetails.setUserId(userId);
            PageInfo<WalletDetails> pageInfo = iWalletDetailsService.selectWalletDetails(walletDetails, offset);
            return Result.success(pageInfo);
        }catch (Exception e){
            return Result.failure(ResultCode.WEB_401,"获取用户信息失败");
        }

    }

}
